<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/4/11
  Time: 11:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<script src="./js/jquery-3.4.1.min.js" type="application/javascript"></script>
<script type="application/javascript">
    $(function () {
        $("#update").click(function (event) {
            var isflag=confirm(`是否确认修改`)
            if(isflag){
                let id=$("#uid").val()
                let name=$("#name").val()
                let password=$("#password").val()
                $.ajax({
                    url:"/user",
                    data:{
                        type: "doUpdateUser",
                        id:id,
                        name:name,
                        password:password
                    },
                    type:"GET",
                    dataType:"json",
                    success:function (data) {
                        if(data.status==200){
                            alert(data.msg)
                            location.href="/user?type=userIndex"
                        }
                    }
                })
            }else {
                alert("取消成功...")
            }
        })
    })

</script>
<body>
        <form action="javascript:void(0)">
               <input hidden type="text" id="uid" value="${user.id}">
            <label>用户名</label>
            <input type="text" id="name" name="name" value="${user.userName}"><br>
            <label>密码</label>
            <input type="password" id="password" name="password" value="${user.password}"><br>
        </form>
        <button id="update">确认修改</button>
</body>
</html>
